package cn.bob.org.service.impl;

import cn.bob.basic.utils.PageList;
import cn.bob.org.domain.UserPic;
import cn.bob.org.mapper.UserPicMapper;
import cn.bob.org.query.UserPicQuery;
import cn.bob.org.service.UserPicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserPicServiceImpl implements UserPicService {

    @Autowired
    private UserPicMapper userPicMapper;


    @Override
    public UserPic findById(Long id) {
        UserPic userPic = userPicMapper.findById(id);
        return userPic;
    }

    @Override
    public List<UserPic> findAll() {
        List<UserPic> userPics = userPicMapper.findAll();
        return userPics;
    }

    @Override
    public void add(UserPic userPic) {
        userPicMapper.add(userPic);

    }

    @Override
    public void delete(Long id) {
        userPicMapper.delete(id);

    }

    @Override
    public void batchDel(List<Long> ids) {
        userPicMapper.batchDel(ids);

    }

    @Override
    public void update(UserPic userPic) {

        userPicMapper.update(userPic);
    }

    @Override
    public PageList<UserPic> queryByPage(UserPicQuery query) {
        List<UserPic> userPics = userPicMapper.queryByPage(query);
        Integer count = userPicMapper.queryByCount(query);
        return new PageList<UserPic>(userPics,count);
    }
}